package com.bestv.search.common.model;

import com.bestv.search.common.util.StringConst;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Justin Luo
 */
public class AccessLog {

    private long id;
    private int type;
    private String description;
    private Date accessUpperTime;
    private Date accessLowerTime;
    private String siteCode;
    private int count;
    private int serverNo;
    private Date lastUpdateTime;

    public AccessLog() {
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getAccessUpperTime() {
        return accessUpperTime;
    }

    public void setAccessUpperTime(Date accessUpperTime) {
        this.accessUpperTime = accessUpperTime;
    }

    public Date getAccessLowerTime() {
        return accessLowerTime;
    }

    public void setAccessLowerTime(Date accessLowerTime) {
        this.accessLowerTime = accessLowerTime;
    }

    public String getSiteCode() {
        return siteCode;
    }

    public void setSiteCode(String siteCode) {
        this.siteCode = siteCode;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getServerNo() {
        return serverNo;
    }

    public void setServerNo(int serverNo) {
        this.serverNo = serverNo;
    }

    public Date getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(Date lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    @Override
    public String toString() {
        SimpleDateFormat df = new SimpleDateFormat(StringConst.DATEFTIMEFORMAT);

        StringBuilder sb = new StringBuilder();

        sb.append("{Type: ");
        sb.append(type);
        sb.append(", accessLowerTime: ");
        sb.append(df.format(accessLowerTime));
        sb.append(", accessUpperTime: ");
        sb.append(df.format(accessUpperTime));
        sb.append(", siteCode: ");
        sb.append(siteCode);
        sb.append(", serverNo: ");
        sb.append(serverNo);
        sb.append(", count: ");
        sb.append(count);
        sb.append("}");

        return sb.toString();
    }

    public AccessLog clone() {
        AccessLog log = new AccessLog();
        log.id = this.id;
        log.type = this.type;
        log.description = this.description;
        log.accessLowerTime = (Date) this.accessLowerTime.clone();
        log.accessUpperTime = (Date) this.accessUpperTime.clone();
        log.accessLowerTime = this.accessLowerTime;
        log.count = this.count;
        log.serverNo = this.serverNo;
        log.siteCode = this.siteCode;
        log.lastUpdateTime = this.lastUpdateTime;

        return log;
    }
}